layui.use(['form', 'element', 'jquery'], () => {
    let form = layui.form, $ = layui.jquery;
    getAdmin((data) => {
        $("input[name='id']").val(data.id)
    });
    form.verify({
        pass: [
            /^[\S]{6,12}$/
            , '密码必须6到12位，且不能出现空格'
        ],
        repass: (value, item) => {
            if (value !== $("input[name='password']").val()) {
                return "两次输入的密码不一致";
            }
        }
    });
    form.on('submit(setmypass)', function (data) {
        let params = filterFormOnNull(data.field);
        ajax("/back/admin/changePassword", "GET", params, (res) => {
            if (res.code === 0) {
                window.parent.document.getElementById("logout").click();
            }
            layer.tips(res.msg, $("input[name='currentPassword']"));
        });
        return false;
    });
});